<!--<?php
print <<<EOT
-->
<div class="m"></div>
<!--
EOT;
if(!$action){
print <<<EOT
-->
<div class="WarningMsg">此操作具备危险性，请勿随意操作，且建议在操作之前，先备份数据库。</div>
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td colspan="7">自定义模型管理</td>
  </tr>
  <tr class="tr2">
    <td width="3%">&nbsp;</td>
    <td>模型ID</td>
    <td>模型名称</td>
    <td>可搜索</td>
    <td>模型管理</td>
    <td>来源/作者</td>
    <td>描述</td>
  </tr>
<!--
EOT;
foreach($moduledb as $value){
$value[search] = $value[search] == 1 ?  'Y' : 'N';
print <<<EOT
-->
  <tr class="tr3">
    <td><img src="images/admin/mod.gif" border="0" align="absmiddle" /></td>
    <td>$value[mid]</td>
    <td>$value[mname]</td>
    <td>$value[search]</td>
    <td>&nbsp;
<!--
EOT;
if($value[mid]>=1){
print <<<EOT
-->
<a href="$basename&action=edit&mid=$value[mid]"><img src="images/admin/edit.png" align="absmiddle" alt="编辑" /></a> 
<a href="$basename&action=del&mid=$value[mid]" onclick="return confirm('确定要删除选中的{$very[contentName]}模型吗？');"><img src="images/admin/delete.png" align="absmiddle" alt="删除" /></a>

<!--
EOT;
}if($value[mid]>=1){
print <<<EOT
-->
<a href="$basename&action=export&mid=$value[mid]"><img src="images/admin/export.gif" align="absmiddle" alt="导出" /></a>
<!--
EOT;
}print <<<EOT
--></td>
    <td>$value[author]&nbsp;</td>
    <td>$value[descrip]&nbsp;</td>
  </tr>
<!--
EOT;
}print <<<EOT
-->
</table>
</div>
<div class="t">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr class="head">
      <td>添加新模型</td>
    </tr>
    <tr class="line">
      <td>
	  <form action="$basename" method="post">
	  模型名称:
	    <input name="mname" type="text" class="input" id="mname">
	    &nbsp;&nbsp;自定义模型ID:
	    <input name="mid" type="text" class="input" id="mid" size="4" maxlength="4" />
	    (不可重复)&nbsp;&nbsp; 简单描述:
	    <input name="descrip" type="text" id="descrip" size="30" class="input" />
        <input name="action" type="hidden" id="action" value="add">
        <input type="submit" name="Submit" value="提交" class="btn">
	  </form>
	  </td>
    </tr>
  </table>
</div>
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td>导入新模型</td>
    </tr>
<form action="$basename" method="post" enctype="multipart/form-data">
  <tr class="line">
    <td>请选择要导入的文件&nbsp;&nbsp;
    	<input name="xmlfile" type="file" class="input" id="xmlfile" size="30" />
      	<input name="action" type="hidden" id="action" value="import" />      	<input type="submit" name="Submit5" value="导入" class="btn" /></td>
    </tr>
</form>
</table>

</div>
<!--
EOT;
}elseif($action=='edit'){
print <<<EOT
-->
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td>模型编辑</td>
    </tr>
  <tr class="line">
    <td>
      <form action="$basename" method="post">
        模型名称:&nbsp;&nbsp;
        <input name="mname" type="text" class="input" id="mname" value="$mname" />
&nbsp;&nbsp;        是否搜索:
        <input type="radio" name="search" value="1" $ifsearch_Y />
        是 
        <input type="radio" name="search" value="0" $ifsearch_N />
         否
         <input name="mid" type="hidden" id="mid" value="$mid" />
        <input name="step" type="hidden" id="step" value="2" />
        <input name="action" type="hidden" id="action" value="edit" />
        <input type="submit" name="Submit2" value="更改模型" class="btn" />
        <input type="button" name="Submit3" value="增加新字段" class="btn" onclick="window.location='$basename&action=addfield&mid=$mid';" />
      </form></td>
    </tr>
</table>
</div>
<form action="$basename" method="post">
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td colspan="6">模型字段管理</td>
    </tr>
  <tr class="tr2">
    <td>字段名称</td>
    <td>字段ID</td>
    <td>字段类型</td>
    <td>采集项</td>
    <td>排序</td>
    <td>操作</td>
  </tr>
<!--
EOT;
foreach($fielddb as $value){
print <<<EOT
-->
  <tr class="tr3">
    <td>$value[fieldname]</td>
    <td>$value[fieldid]</td>
    <td>$value[fieldtype]{$value[fieldsize]}</td>
    <td>$value[ifgather]</td>
    <td><input name="vieworder[$value[fid]]" type="text" class="input" id="vieworder[$value[fid]]" value="$value[vieworder]" size="5" maxlength="5" /></td>
    <td>
	<a href="$basename&action=editfield&fid=$value[fid]&mid=$value[mid]" onclick="return confirm('编辑一个字段可能存在潜在的危险，有可能因为数据类型的改变而丢失信息。\\n\\n您确认要对它进行编辑吗？');"><img src="images/admin/f_edit.png" alt="编辑" border="0" align="absmiddle" /></a>
	<a href="$basename&action=delfield&fid=$value[fid]&mid=$value[mid]" onclick="return confirm('删除一个字段将会影响到所有该模型下的{$very[contentName]}，并且存储在该字段下所有的信息都会丢失。\\n\\n您确认要删除吗？');"><img src="images/admin/f_drop.png" align="absmiddle" alt="删除" /></a>
</td>
  </tr>
<!--
EOT;
}print <<<EOT
-->
  <tr class="tr3">
    <td colspan="6">&nbsp;</td>
    </tr>
</table>
</div>
<div class="sub">
  <input name="action" type="hidden" id="action" value="vieworder" />
  <input name="mid" type="hidden" id="mid" value="$mid" />
  <input type="submit" name="Submit4" value="提交" class="btn" />
</div>
</form>
<!--
EOT;
}elseif($action=='addfield' || $action=='editfield'){
print <<<EOT
-->
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td>注意事项</td>
  </tr>
  <tr class="tr3">
    <td>1. tid,cid,postdate,publisher为系统内嵌字段,分别表示一个{$very[contentName]}的主ID,所属分类,发布时间,发布者,不可编辑.
	<br />
2. title字段不可删除,为一个{$very[contentName]}的标题,可以编辑,不可缺少.<br />
3. photo字段默认为{$very[contentName]}图片,可以自己定义.<br />
4. 部分字段名称可能会跟MySQL保留字冲突,如果出现错误请更换字段ID<br />
5. <span style="color:#FF0000">如果您提交的字段类型和字段长度不符合，程序将会自动更正.</span></td>
  </tr>
</table>
</div>
<form action="$basename" method="post">
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td colspan="2">$mname 编辑字段</td>
    </tr>
  <tr class="line">
    <td width="25%">字段名称</td>
    <td width="75%"><input name="fieldname" type="text" class="input" id="fieldname" value="$fieldname" maxlength="10" /></td>
  </tr>
  <tr class="line">
    <td>字段ID</td>
    <td><input name="fieldid" type="text" class="input" id="fieldid" value="$fieldid" maxlength="12" />
      (必须为英文)</td>
  </tr>
  <tr class="line">
    <td>字段类型</td>
    <td><select name="fieldtype" id="fieldtype">
		<option value="tinyint">布尔值</option>
		<option value="smallint" $smallint_s>数字</option>
		<option value="int" $int_s>较大数字</option>
		<option value="varchar" $varchar_s>字符串</option>
		<option value="text" $text_s>一般文本</option>
		<option value="mediumtext" $mediumtext_s>中等文本</option>
		<option value="longtext" $longtext_s>大型文本</option>
	</select>(一般数字的最大值为32767，字符串的最大长度为255)</td>
  </tr>
  <tr class="line">
    <td>字段长度</td>
    <td><input name="fieldsize" type="text" class="input" id="fieldsize" value="$fieldsize" />
      (数字长度为数字的位数,字符串长度为字符的长度,建议按照需要设置)</td>
  </tr>
  <tr class="line">
    <td>字段输入类型</td>
    <td><select name="inputtype" id="inputtype">
      <option value="input" $input_i>输入框</option>
      <option value="textarea" $textarea_i>文本框</option>
      <option value="select" $select_i>下拉菜单</option>
      <option value="radio" $radio_i>单选框</option>
      <option value="checkbox" $checkbox_i>复选框</option>
      <option value="edit" $edit_i>{$very[contentName]}编辑器</option>
	  <option value="basic" $basic_i>简易编辑框</option>
    </select>    </td>
  </tr>
  <tr class="line">
    <td>预设值选择器</td>
    <td><select name="getvalue" id="getvalue">
      <option value="0" $getvalue_0>默认方式</option>
      <option value="1" $getvalue_1>颜色</option>
      <option value="2" $getvalue_2>附件</option>
<!--
EOT;
include(D_P.'data/cache/select.php');
foreach($selectdb as $s){
print <<<EOT
-->
      <option value="$s[selectid]" ${'getvalue_'.$s[selectid]}>$s[selectname]</option>
<!--
EOT;
}print <<<EOT
-->
    </select>    </td>
  </tr>
  <tr class="line">
    <td>默认值</td>
    <td><input name="defaultvalue" type="text" class="input" id="defaultvalue" value="$defaultvalue" />
      (多个可选值用|分开，默认值不可以含有逗号,以及竖线|)</td>
  </tr>
  <tr class="line">
    <td>输入框相应说明</td>
    <td><input name="inputlabel" type="text" class="input" id="linputlable" value="$inputlabel" />
      (可以跟默认值相对应，多个值用|分开)</td>
  </tr>
  <tr class="line">
    <td>输入框长度</td>
    <td><input name="inputsize" type="text" class="input" id="inputsize" value="$inputsize" />
      (输入{$very[contentName]}的输入框长度,0-120,可留空)</td>
  </tr>
<!--
EOT;
if($moduledb[$this->mid][search]){
print <<<EOT
-->
  <tr class="line">
    <td>是否可搜索</td>
    <td><input type="radio" name="ifsearch" value="1" $search_Y />
      可搜索 
        <input type="radio" name="ifsearch" value="0" $search_N />
        不可搜索 <br />
        (搜索很耗服务器资源，请慎重设置，对于一般字段若要可供搜索，同时请索引该字段) </td>
  </tr>
<!--
EOT;
}print <<<EOT
-->
  <tr class="line">
    <td>是否为采集项</td>
    <td><input type="radio" name="ifgather" value="1" $ifgather_Y />
      可采集
      <input name="ifgather" type="radio" value="0" $ifgather_N />
      不采集 </td>
  </tr>
</table>
</div>
<div class="sub">
<input name="action" type="hidden" id="action" value="$action" />
<input name="step" type="hidden" id="step" value="2" />
<input name="mid" type="hidden" id="mid" value="$this->mid" />
<input name="fid" type="hidden" id="fid" value="$fid" />
<input name="oldid" type="hidden" id="oldid" value="$fieldid" />
<input type="submit" value="提交" class="btn" />
</div>
</form>
<!--
EOT;
}
?>-->